#-*- codeing = utf-8 -*-
#@Time : 2020/8/6 12:56
#@Author : 阳某
#@File : test1.py
#@Software : PyCharm

import requests
from urllib.parse import urlencode
from urllib.parse import quote
from fake_useragent import UserAgent
from random import  choice

lis = [1,2,3,'a','b']
print(choice(lis))

ua = UserAgent()
print(ua.chrome)
print(ua.firefox)

# 单个参数用quote
a = "尚学堂"
print(quote(a))
print(quote(quote(a)))

args = {
    "wd":"尚学堂",
    "ie":"utf-8"
}
headers = {
    'User-Agent':UserAgent().random
}
print(headers['User-Agent'])
print(headers)
url = 'https://www.baidu.com/s?{}'.format(urlencode(args))
print(url)
# res = requests.get(url,headers = headers)
# print(res.status_code)

